package com.syqc.monitor.ui.historyline

import android.content.Context
import android.graphics.drawable.ColorDrawable
import android.view.LayoutInflater
import android.widget.LinearLayout
import android.widget.PopupWindow
import com.syqc.monitor.R
import com.syqc.monitor.databinding.PopupHistoryLegendBinding

/**
 *@author  hfjs
 *@time   2025/3/4 16:26
 *@desc
 */
class HistoryPopup(context: Context) : PopupWindow() {
    private val binding = PopupHistoryLegendBinding.inflate(LayoutInflater.from(context))

    init {
        contentView = binding.root
        isFocusable = true //popupwindow设置焦点
        isOutsideTouchable = true //点击外面窗口消失
        isClippingEnabled = false //设置是否裁剪内容
        width = LinearLayout.LayoutParams.MATCH_PARENT //设置SelectPicPopupWindow弹出窗体的宽
        height = LinearLayout.LayoutParams.MATCH_PARENT //设置SelectPicPopupWindow弹出窗体的高
        setBackgroundDrawable(ColorDrawable(-0x56000000)) //设置背景

        binding.ivClose.setOnClickListener { dismiss() } //关闭按钮
        binding.tvSpeed.text = "${context.getString(R.string.desc_run_speed)}:"
        binding.tvStopLong.text = "${context.getString(R.string.desc_stop_time)}:"
    }
}